﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using PeonyShop.Bussiness;
using System.Web.Services;
using PenoyShop.Utilities;

namespace PeonyShop.Common
{
    public partial class Ajax : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        [WebMethod]
        public static string GetImgByName(string sName, int IsActive, int IsDelete)
        {
            DataSet ds = new BACategory().GetCategoryByName(sName, IsActive,IsDelete);
            string sCateId = string.Empty;
            if (ds != null)
            { 
                DataTable dt = ds.Tables[0];
                if(dt.Rows.Count>0)
                {
                    sCateId = dt.Rows[0]["CateId"].ToString();
                }
                     
            }
            DataSet dsimg = new BImage().GetImage(string.Empty, CodeHelper.ToInt(sCateId), 0, 0, -1, 1, 1, false);
            string sImgPath = string.Empty;
            if (dsimg != null)
            {
                DataTable dt = dsimg.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    sImgPath = dr["ImgPath"].ToString();
                }
            }
            return sImgPath;
        }



    }
}